//
// The resource management layer has been upgraded, thus deprecating this file.
//
#error *** resentry.h has been deprecated. ***

#ifndef RESENTRY_H
#define RESENTRY_H

typedef struct _CResEntry
{
#if defined(DEBUG_CRESENTRY)
	uint32		cMagic;
#endif

#if defined(DEBUG_CRESENTRY) || defined(RESCOMPILER)
	char 		cName[ resfileNAME_LENGTH ];
	uint32		cGroup;
#endif

	uint32		cOffset;
	uint32		cSize;
	uint32		cCompressedSize;
	uint32		cUseCount;
	void *		cData;
	void *		cUserData;
} CResEntry;

#define RESENTRY_MAGIC		endianLITERAL('R','E','N','T')


PLIBEXP pCResEntry	newCResEntry(RFEntry * FileEntry, uint32 ResGrp);
PLIBEXP pCResEntry	newCCompressedResEntry(RFCompressedEntry * FileEntry, uint32 ResGrp);
PLIBEXP void		deleteCResEntry(pCResEntry This);
void				CResEntryConstruct(pCResEntry, RFEntry *, uint32, bool8);
void				CResEntryDestruct(pCResEntry This);
PLIBEXP void *		CResEntryGetData(pCResEntry This);
PLIBEXP bool8		CResEntryReleaseData(void * Data);
PLIBEXP void *		CResEntryAllocDataSpace(pCResEntry This);


// These will become part of the ResData class as soon as I write it!
PLIBEXP void		CResEntrySetUserData(void * Data, void * UserData);
PLIBEXP void *		CResEntryGetUserData(void * Data);
PLIBEXP uint32		CResEntryQueryUseCount(void * Data);
PLIBEXP uint32		CResDataSize(void * ResData);


#define				CResEntryOffset(This)		((This)->cOffset)
#define				CResEntrySize(This)			((This)->cSize)

#if defined(DEBUG_CRESENTRY) || defined(RESCOMPILER)
#  define			CResEntryName(This)			((This)->cName)
#  define			CResEntryGroup(This)		((This)->cGroup)
#endif



// Private methods and structures.
typedef struct _CResData
{
#if defined(DEBUG_CRESENTRY)
	uint32			cMagic;
#endif

	pCResEntry 		cRefPointer;
} CResData;

#define RESDATA_MAGIC		endianLITERAL('R','D','A','T')


#define RESDATA(This)		((CResData *)(This))

#define ResDataHeader(Data)	\
			((CResData *)(((uint32)(Data)) - sizeof(CResData)))
#define ResDataData(Header)	\
			((void *)(((uint32)(Header)) + sizeof(CResData)))


//----------------------------------------------------------------------------
//  Everything below this line has been written specifically for the 
//     Resource Compiler.
//
#ifdef RESCOMPILER
pCResEntry	newCResEntryWithData(char * ResName, uint32 ResGrp, void * ResData, 
				uint32 Length);
void		CResEntryConstructWithData(pCResEntry This, char * ResName, 
				uint32 ResGrp, void * ResData, uint32 Length);
#endif


#endif
